package com.hk.springbootmybatisplus.controller;

import com.hk.springbootmybatisplus.entity.Employee;
import com.hk.springbootmybatisplus.mapper.EmployeeMapper;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author by 何坤
 * @Classname TestSwaggerController
 * @Description TODO
 * @Date 2019/9/29 13:40
 */
@RestController
public class TestSwaggerController {

    @Resource
    private EmployeeMapper employeeMapper;

    @GetMapping("/hello")
    public String sayHello(){
        return "hello world";
    }

    @ApiOperation("根据ID获得Employee的信息")
    @GetMapping("/employee/{id}")
    public Employee getEmployee(@PathVariable("id") @ApiParam("Employee的ID") Integer id){
        return employeeMapper.selectById(id);
    }
}
